<?php include "../db/db_connect.php"; ?>
<?php include "../global_variables.php"; ?>

<?php
	echo "<table class=\"sortable\" id=\"dataintable\">
		    <tr>
				<th>IP</th>
				<th>Name</th>
				<th>Location</th>
				<th>OS</th>
				<th>CPU</th>
				<th>Memory</th>
				<th>HDD</th>
				<th>NA Build</th>
				<th>SART Build</th>
				<th>Status</th>
			</tr>";		
				
	
	$qry = "select host_ip, host_name, location, os, cpu, memory, harddisk, user_name, na_build_id, sart_build_id, status from host_view";
	if (isset($_GET["user"])) {
	    $qry = $qry . " where user_name='{$_GET['user']}'";
	}
	$ds  = mysql_query($qry, $con);
	while ($data = mysql_fetch_array($ds)) {
		$host_ip = $data['host_ip'];
		$host_name = $data['host_name'];
		$host_location = $data['location'];
		$host_os = $data['os'];
		$host_cpu = $data['cpu'];
		$host_memory = $data['memory'];
		$host_hdd = $data['harddisk'];
		$user_name = $data['user_name'];
		$na_build = $data['na_build_id'];
		$sart_build = $data['sart_build_id'];
		$host_status = $data['status'];
		
		$checkbox = "<input type=\"checkbox\" name=\"HostSelection[]\" value=\"{$host_ip}\" style=\"float:left\" />";
		if ($user_name != "") {
		    $checkbox = "<input type=\"checkbox\" name=\"HostSelection[]\" value=\"{$host_ip}\" style=\"float:left\" disabled=\"disabled\" />
			             <img src=\"images/16x16/blue_anime.gif\" title=\"{$user_name}\"/>";
		}
						
		echo "<tr>
				<td>{$host_ip}</td>
				<td>{$host_name}</td>
				<td>{$host_location}</td>
				<td>{$host_os}</td>
				<td>{$host_cpu}</td>
				<td>{$host_memory}</td>
				<td>{$host_hdd}</td>
				<td>{$na_build}</td>
				<td>{$sart_build}</td>
				<td><img src=\"{$HOST_STATUS[$host_status]['IMAGE']}\" title=\"{$HOST_STATUS[$host_status]['TITLE']}\" /></td>
			  </tr>\n";
		}
	
	echo "</table>";
?>
				
<?php include "../db/db_close.php"; ?>